package com.tuanzi.loan.web.bean.compensation;

import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.vo.request.compensation.CompensationCompanyInfoRequest;
import com.tuanzi.loan.vo.response.compensation.CompensationCompanyInfoResponse;
import com.tuanzi.loan.web.configuration.JSFListingBean;
import com.tuanzi.loan.web.lazy.compensation.CompensationCompanyInfoLazyDataModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;

/**
 * @author caiwanlin
 * @create 2019-02-12 14:29
 */
@Data
@Debug
@Component
@ViewScoped
@EqualsAndHashCode(callSuper = true)
public class CompensationCompanyInfoListBean extends
        JSFListingBean<CompensationCompanyInfoRequest,CompensationCompanyInfoResponse>{
    @PostConstruct
    public void init() throws Exception {
        initLazyDataModel();
    }

    private void initLazyDataModel() throws Exception {
        $ = new CompensationCompanyInfoRequest();
        lazyDataModel = new CompensationCompanyInfoLazyDataModel($);
    }

    public void onReset() throws Exception{
        initLazyDataModel();
    }

    public String onAdd(){
        return redirect("/views/family/credithousekeeper/compensation/compensation-company-info.xhtml");
    }

    public String onSee(Long id){
        return redirect("/views/family/credithousekeeper/compensation/compensation-company-info.xhtml?id="+id);
    }
}
